<!DOCTYPE html>


<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>无标题文档</title>
	
</head>

<body onload="fun()">
	<input id="pmd" type="text" style="text-align:right" />
	<input type="button" onclick="funstop()" />
	<script language="javascript">
		var msg1 = "abcdefghijklmn";
		var msgaaa = "abcdefghijklmn";
		var i = 0;
		var id;

		function fun() {
			if(i > msg1.length) {
				i = 0;
			}
			var txt1 = document.getElementById("pmd");
			var msg2 = msg1.substring(0, msg1.length - i);
			txt1.value = msg2;
			i++;
			id = setTimeout("fun()", 500);
		}
		var flag = true;

		function funstop() {
			if(flag == true) {
				window.clearTimeout(id);
				flag = false;
			} else {
				id = setTimeout("fun()", 500);
				flag = true;
			}
		}
	</script>
</body>

</html>

</html>